import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutterhello/util/host_util.dart';
import 'package:flutterhello/widgets/tips_card.dart';
import 'package:get/get.dart';

class ActTeamListPage extends StatefulWidget {
  @override
  _ActTeamListPageState createState() => _ActTeamListPageState();
}

class _ActTeamListPageState extends State<ActTeamListPage> {
  var items = [];

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    this.items = Get.arguments;
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text('参与人员'),
          centerTitle: true,
        ),
        body: items != null
            ? EasyRefresh.custom(
                slivers: <Widget>[
                  SliverList(
                    delegate: SliverChildBuilderDelegate(
                      (context, index) {
                        return Padding(
                          padding: EdgeInsets.only(
                            left: 20,
                            right: 20,
                          ),
                          child: Column(
                            children: [
                              SizedBox(
                                height: 10,
                              ),
                              TipsCard(
                                favicon: HostUtil.getHost() +
                                    items[index]['favicon'],
                                name: items[index]['name'],
                              ),
                            ],
                          ),
                        );
                      },
                      childCount: this.items.length,
                    ),
                  )
                ],
              )
            : Center(
                child: Text('暂无人员加入'),
              ));
  }
}
